<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>情感分析结果</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
    <div class="container">
        <h1>情感分析结果</h1>
        
        <div class="result-section">
            <h2>输入文本</h2>
            <p class="input-text">{{ text }}</p>
        </div>
        
        <div class="result-section">
            <h2>分析结果</h2>
            <div class="sentiment-result">
                <div class="sentiment-label">情感倾向：</div>
                <div class="sentiment-value sentiment-{{ sentiment }}">{{ sentiment }}</div>
            </div>
            <div class="score-result">
                <div class="score-label">情感分数：</div>
                <div class="score-value">{{ score }}</div>
            </div>
        </div>
        
        <div class="result-section">
            <h2>结果解读</h2>
            <div class="sentiment-explanation">
                {% if sentiment == '正面' %}
                <p>这段文本表达了积极、正面的情感。情感分数为{{ score }}，表明作者对所描述的内容持有肯定或满意的态度。</p>
                {% elif sentiment == '负面' %}
                <p>这段文本表达了消极、负面的情感。情感分数为{{ score }}，表明作者对所描述的内容持有否定或不满的态度。</p>
                {% else %}
                <p>这段文本情感较为中性。情感分数为{{ score }}，表明作者对所描述的内容没有明显的情感倾向。</p>
                {% endif %}
            </div>
        </div>
        
        <div class="result-visualization">
            <h2>情感可视化</h2>
            <div class="sentiment-bar">
                <div class="bar-container">
                    <div class="sentiment-negative-bar" style="width: {{ (0.5 - score/2) * 100 }}%"></div>
                    <div class="sentiment-neutral-bar" style="width: {{ score|abs * 100 }}%"></div>
                    <div class="sentiment-positive-bar" style="width: {{ (0.5 + score/2) * 100 }}%"></div>
                </div>
                <div class="bar-labels">
                    <span>负面</span>
                    <span>中性</span>
                    <span>正面</span>
                </div>
            </div>
        </div>
        
        <div class="action-buttons">
            <a href="{{ url_for('index') }}" class="back-btn">返回主页</a>
        </div>
    </div>
</body>
</html>